package cn.yunyichina.provider.message.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.yunyichina.provider.message.dao.MessageRouterDao;
import cn.yunyichina.provider.message.entity.MessageRouter;
import cn.yunyichina.utils.convert.JsonUtils;

/**
 * 消息路由
 */
@Service("messagerouterServiceImpl")
public class MessageRouterServiceImpl {
    
	private static final Logger logger = LoggerFactory.getLogger(MessageRouterServiceImpl.class);
    @Autowired
    private MessageRouterDao messageRouterDao;

    /**
     * 匹配消息发送的paymentSetting
     * @param strJson platformOrgAppCode,orgCode,platformType
     * @return
     */
    public MessageRouter selectRouterForMatch(String strJson) {
    	MessageRouter messageRouter = JsonUtils.parseObject(strJson,MessageRouter.class);
    	return messageRouterDao.selectRouterForMatch(messageRouter.getPlatformOrgAppCode(), messageRouter.getDevOrgCode(), messageRouter.getPlatformType().intValue());
    	
    }
    /**
     * 匹配消息发送的paymentSetting
     * 
     * @param platformOrgAppCode
     * @param orgCode 可以为空
     * @param platformType 1微信，2支付宝，3APP
     * @return
     */
    public MessageRouter selectRouterForMatch(String platformOrgAppCode,String orgCode,Integer platformType) {
    	return messageRouterDao.selectRouterForMatch(platformOrgAppCode,orgCode,platformType);
    }
   
}
